<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>Change_Password</title>

    <%@include file="common.jsp" %>
    <%--<link rel="stylesheet" href="/static/js/jquery-easyui/themes/style.css">--%>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <!-- 对用户输入的信息进行验证，要求信息不可以为空，两次输入的密码不可以是一样的 -->
    <script language="javascript">
        function isValidate(form){

            //获取表单信息
            username=form.Username.value;
            password=form.Password.value;
            confirm_password=form.Confirm_Password.value;
            confirm_password2=form.Confirm_Password2.value;
            //判断用户是否输入的完整的信息
            if(username==""||password==""||confirm_password==""){
                alert("请输入所有信息");
                return false;
            }else if(password==confirm_password){
                //判断用户是否输入了形同的密码
                alert("新密码不可以与原密码相同！");
                return false;
            }else if(confirm_password != confirm_password2){
                alert("两个新密码不一致!");
                return false;
            }else{
                return true;
            }

        }
    </script>
    <style type="text/css">
        .Change_Password_mainbody{
            position:absolute;
            left:400px;
            top:200px;
        }
    </style>
</head>

<body>
<h2 style="color:lightgreen">修改密码</h2><hr/>

<!-- 当用户点击 提交 按钮后，这份表单是否可以提交还取决于form中设置的onsubmit属性是真还是假 -->
<div id="pass_dialog">
    <form name="form1" method="post" action="servlet/Change_Password" onsubmit="return isValidate(form1)">
        <%--<div class="Change_Password_mainbody">--%>
            <%--&nbsp;&nbsp;&nbsp;用户<input type="text" name="Username" value="<shiro:principal property="username" />" readonly="readonly"/><br/><br/>--%>
            <%--原密码<input type="password" name="Password"><br/><br/>--%>
            <%--新密码<input type="password" name="Confirm_Password"><br/><br/>--%>
            <%--<input type="submit" value="修改" />--%>
            <%--<input type="reset" value="重置" />--%>
        <%--</div>--%>
            <div align="center" style="margin-top: 10px;" >
                <div>
                    <input type="text" name="Username" class="easyui-textbox" data-options="label:'用户名:',labelPosition:'top', width:150"value="<shiro:principal property="username" />" readonly="readonly">
                </div>
                <div>
                    <input type="password" name="Password" class="easyui-textbox" data-options="label:'原密码:',labelPosition:'top', width:150">
                </div>
                <div>
                    <input type="password" name="Confirm_Password" class="easyui-textbox" data-options="label:'新密码:',labelPosition:'top', width:150">
                </div>
                <div>
                    <input type="password" name="Confirm_Password2" class="easyui-textbox" data-options="label:'确认密码:',labelPosition:'top', width:150">
                </div>
                <div id="employee_dialog_bt">
                    <input class="easyui-linkbutton"  type="submit" value="修改" />

                    <input class="easyui-linkbutton"  type="reset" value="重置" />
                </div>
            </div>
    </form>
</div>
</body>
</html>